package com.gd.coreservice.mapper;

import com.gd.coreservice.entity.Goods;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author testjava
 * @since 2024-03-23
 */
public interface GoodsMapper extends BaseMapper<Goods> {
    @Select("SELECT * FROM goods WHERE seller_id=#{uid} AND (IFNULL(status,'') LIKE concat('%', #{status}, '%')) AND (IFNULL(name,'') LIKE concat('%', #{name}, '%')) ORDER BY created_at DESC")
    List<Goods> getGoods(String uid, String status, String name);

    @Select("SELECT count(*) FROM goods WHERE seller_id=#{uid} AND (IFNULL(status,'') LIKE concat('%', #{status}, '%')) AND (IFNULL(name,'') LIKE concat('%', #{name}, '%')) ")
    Integer gettotal(String uid, String status, String name);

}
